const express = require('express');
const router = express.Router();
const menuController = require('../controllers/menuController.js');

/**
 * POST /api/initMenus
 * @security BearerAuth
 * @header {string} Authorization - Bearer Token认证信息，格式为: Bearer {token}
 * @tags menu
 * @summary 初始化菜单数据
 * @return {object} 200 - success
 */

router.post('/initMenus', menuController.initMenus);

/**
 * GET /api/menus
 * @security BearerAuth
 * @header {string} Authorization - Bearer Token认证信息，格式为: Bearer {token}
 * @tags menu
 * @summary 获取菜单列表
 * @return {object} 200 - success
 */
router.get('/menus', menuController.getAllMenus);

/**
 * POST /api/menus
 * @security BearerAuth
 * @header {string} Authorization - Bearer Token认证信息，格式为: Bearer {token}
 * @tags menu
 * @param {object} request.body - 请求体参数
 * @param {Menu} request.body - 菜单
 * @summary 创建菜单
 * @return {object} 200 - success
 */

router.post('/menus', menuController.createMenu);

/**
 * PUT /api/menus/{id}
 * @security BearerAuth
 * @header {string} Authorization - Bearer Token认证信息，格式为: Bearer {token}
 * @tags menu
 * @param {string} id.path.required - 菜单ID
 * @summary 更新菜单
 * @return {object} 200 - success
 */

router.put('/menus/:id', menuController.updateMenu);
/**
 * DELETE /api/menus/{id}
 * @security BearerAuth
 * @header {string} Authorization - Bearer Token认证信息，格式为: Bearer {token}
 * @tags menu
 * @param {string} id.path.required - 菜单ID
 * @summary 删除菜单
 * @return {object} 200 - success
 */

router.delete('/menus/:id', menuController.deleteMenu);

router.get('/menus/role',menuController.getRoleMenus)
module.exports = router;
